/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package by.bsuir.bbs.persistence;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;

/**
 *
 * @author Администратор
 */
@Embeddable
public class AdPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "ad_id")
    private int adId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "user_iduser")
    private int userIduser;

    public AdPK() {
    }

    public AdPK(int adId, int userIduser) {
        this.adId = adId;
        this.userIduser = userIduser;
    }

    public int getAdId() {
        return adId;
    }

    public void setAdId(int adId) {
        this.adId = adId;
    }

    public int getUserIduser() {
        return userIduser;
    }

    public void setUserIduser(int userIduser) {
        this.userIduser = userIduser;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) adId;
        hash += (int) userIduser;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AdPK)) {
            return false;
        }
        AdPK other = (AdPK) object;
        if (this.adId != other.adId) {
            return false;
        }
        if (this.userIduser != other.userIduser) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "by.bsuir.bbs.jpa.AdPK[ adId=" + adId + ", userIduser=" + userIduser + " ]";
    }
    
}
